<!DOCTYPE html>
<!--[if IE 8]> <html lang="en" class="ie8"> <![endif]-->
<!--[if !IE]><!-->
<html lang="en">
<!--<![endif]-->
<head>
    <meta charset="utf-8" />
    <title>祈贝健康--后台管理系统</title>
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport" />
    <meta content="" name="description" />
    <meta content="" name="author" />

    <!-- ================== BEGIN BASE CSS STYLE ================== -->
    <link href="./Public/Admin/assets/plugins/jquery-ui/themes/base/minified/jquery-ui.min.css" rel="stylesheet" />
    <link href="./Public/Admin/assets/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
    <link href="./Public/Admin/assets/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet" />
    <link href="./Public/Admin/assets/css/animate.min.css" rel="stylesheet" />
    <link href="./Public/Admin/assets/css/style.min.css" rel="stylesheet" />
    <link href="./Public/Admin/assets/css/style-responsive.min.css" rel="stylesheet" />
    <link href="./Public/Admin/assets/css/theme/default.css" rel="stylesheet" id="theme" />
    <!-- ================== END BASE CSS STYLE ================== -->

    <!-- ================== BEGIN PAGE LEVEL STYLE ================== -->
    <link href="./Public/Admin/assets/plugins/DataTables/css/data-table.css" rel="stylesheet" />
    <!-- ================== END PAGE LEVEL STYLE ================== -->

    <!-- ================== BEGIN BASE JS ================== -->
    <script src="./Public/Admin/assets/plugins/pace/pace.min.js"></script>
    <!-- ================== END BASE JS ================== -->
</head>
<body>
<php> include './Public/Admin/header.html'; </php>



<!-- begin #content -->
		<div id="content" class="content">
			<!-- begin breadcrumb -->
			<ol class="breadcrumb pull-right">
				<li><a href="javascript:;">首页</a></li>
				<li><a href="javascript:;">医院管理</a></li>
				<li class="active">修改医院</li>

			</ol>
			<!-- end breadcrumb -->
			<!-- begin page-header -->
			<h1 class="page-header">医院管理 <small>修改医院</small></h1>
			<!-- end page-header -->

			<!-- begin row -->
			<div class="row">
			    <!-- begin col-12 -->
			    <div class="col-md-12">
			        <!-- begin panel -->
                    <div class="panel panel-inverse">
                        <div class="panel-heading">
                            <div class="panel-heading-btn">
                                <a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-default" data-click="panel-expand"><i class="fa fa-expand"></i></a>
                                <a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-success" data-click="panel-reload"><i class="fa fa-repeat"></i></a>
                                <a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-warning" data-click="panel-collapse"><i class="fa fa-minus"></i></a>
                                <a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-danger" data-click="panel-remove"><i class="fa fa-times"></i></a>
                            </div>
                            <h4 class="panel-title">修改医院</h4>
                        </div>
                        <div class="panel-body">
                            <div class="table-responsive">


                                                                  <!--表单-->

                                        <div class='col-md-10'>
                                            <form class='form-horizontal' role='form'  method="post" action="index.php?m=Admin&c=Hospital&a=lists&type=2" enctype="multipart/form-data">
                                            <div class='form-group'>
                                                <label for='inputtext' class='col-md-2 control-label'>医院名：</label>
                                                <div class='col-md-4'>
                                                    <input type='text' class='form-control input-lg' name="name" id='name' placeholder='请输入医院名' value="">
                                                </div>
                                            </div>
                                                <div class='form-group'>
                                                <label for='inputtext' class='col-md-2 control-label'>所属国家：</label>
                                                <div class='col-md-4'>
                                                    <select onchange="loads()" class='form-control' name="cid" id="cid">


                                                    </select>
                                                </div>
                                            </div>
                                                <div class='form-group'>
                                                <label for='inputtext' class='col-md-2 control-label'>所属城市：</label>
                                                <div class='col-md-4'>
                                                    <select class='form-control' name="zid" id="zid">


                                                    </select>
                                                </div>
                                            </div>
                                            <div class='form-group'>
                                                <label for='inputtext' class='col-md-2 control-label'>中文介绍：</label>
                                                <div class='col-md-4'>
                                                    <textarea class="form-control" rows='3' name="descrip" id="descrip" placeholder="请输入中文介绍"></textarea>
                                                </div>
                                            </div>
                                              <div class='form-group'>
                                                <label for='inputtext' class='col-md-2 control-label'>英文文介绍：</label>
                                                <div class='col-md-4'>
                                                    <textarea class="form-control" rows='3' name="abstract" id="abstract"  placeholder="请输入英文介绍"></textarea>
                                                </div>
                                            </div>
                                            <div class='form-group'>
                                                <label for='inputtext' class='col-md-2 control-label'>logo图：</label>
                                                <div class='col-md-4'>
                                                    <input type="file" name="logo_img" id="logo_img"/>
                                                </div>
                                            </div>
                                            <div class='form-group'>
                                                <label for='inputtext' class='col-md-2 control-label'>地址：</label>
                                                <div class='col-md-4'>
                                                    <input type='text' class='form-control input-lg' name="address" id='address' placeholder='请输入地址' value="">
                                                </div>
                                            </div>

                                            <div class='form-group'>
                                                <label for='inputtext' class='col-md-2 control-label'>电话：</label>
                                                <div class='col-md-4'>
                                                    <input type='text' class='form-control input-lg' name="telephone" id='telephone' placeholder='请输入电话' value="">
                                                </div>
                                            </div>
                                                <div class='form-group'>
                                                <label for='inputtext' class='col-md-2 control-label'>经度：</label>
                                                <div class='col-md-4'>
                                                    <input type='text' class='form-control input-lg' name="lat" id='lat' placeholder='请输入经度' value="">
                                                </div>
                                            </div>
                                                <div class='form-group'>
                                                <label for='inputtext' class='col-md-2 control-label'>纬度：</label>
                                                <div class='col-md-4'>
                                                    <input type='text' class='form-control input-lg' name="lng" id='lng' placeholder='请输入纬度' value="">
                                                </div>
                                            </div>
                                                <div class='form-group' id="addInput">
                                                    <label for='inputtext' class='col-md-2 control-label'>酒店图片</label>
                                                    <div class='col-md-4'>
                                                        &nbsp;&nbsp;&nbsp;&nbsp;<a id="but" class="btn btn-primary">加</a>
                                                    </div>

                                                </div>
                                                <div class='form-group' id="addHotel">
                                                    <label for='inputtext' class='col-md-2 control-label'>photo</label>

                                                </div>

                                                <div class='form-group'>
                                                <div class='col-md-3 col-md-offset-2'>
                                                    <button  class='btn btn-success btn-radius'>提交</button>
                                                </div>
                                            </div>
                                            </form>
                                        </div>


                            </div>
                        </div>
                    </div>
                    <!-- end panel -->
                </div>
                <!-- end col-12 -->
            </div>
            <!-- end row -->
		</div>
		<!-- end #content -->


<!-- begin scroll to top btn -->
<a href="javascript:;" class="btn btn-icon btn-circle btn-success btn-scroll-to-top fade" data-click="scroll-top"><i class="fa fa-angle-up"></i></a>
<!-- end scroll to top btn -->
<?php include './header.html'; ?>
<!-- end page container -->

<!-- ================== BEGIN BASE JS ================== -->
<script src="./Public/Admin/assets/plugins/jquery/jquery-1.9.1.min.js"></script>
<script src="./Public/Admin/assets/plugins/jquery/jquery-migrate-1.1.0.min.js"></script>
<script src="./Public/Admin/assets/plugins/jquery-ui/ui/minified/jquery-ui.min.js"></script>
<script src="./Public/Admin/assets/plugins/bootstrap/js/bootstrap.min.js"></script>
<!--[if lt IE 9]>
<script src="./Public/Admin/assets/crossbrowserjs/html5shiv.js"></script>
<script src="./Public/Admin/assets/crossbrowserjs/respond.min.js"></script>
<script src="./Public/Admin/assets/crossbrowserjs/excanvas.min.js"></script>
<![endif]-->
<script src="./Public/Admin/assets/plugins/slimscroll/jquery.slimscroll.min.js"></script>
<!-- ================== END BASE JS ================== -->

<!-- ================== BEGIN PAGE LEVEL JS ================== -->
<script src="./Public/Admin/assets/plugins/DataTables/js/jquery.dataTables.js"></script>
<script src="./Public/Admin/assets/plugins/DataTables/js/dataTables.colVis.js"></script>
<script src="./Public/Admin/assets/js/apps.min.js"></script>
<!-- ================== END PAGE LEVEL JS ================== -->
<script>
		$(document).ready(function() {
			App.init();
            loadc();
		});
        var dataNum=-1;
        function loadc(){
                    var zidd;
                    var country;
                    $.getJSON("index.php?m=Admin&c=Hospital&a=update_list",function(result){
                        if(result!=0){
                            zidd=result.zid;
                            country=result.country;
                            $('#name').val(result.name);
                            $('#abstract').val(result.abstract);
                            $('#descrip').val(result.descrip);
                            $('#address').val(result.address);
                            $('#telephone').val(result.telephone);
                            $('#lat').val(result.lat);
                            $('#lng').val(result.lng);
                        }
                    });


                    var cid;
                    $.ajaxSettings.async = false; 
                    $.getJSON("index.php?m=Admin&c=Hospital&a=country_list",function(result){

                        var html='<option value="-1">--请选择--</option>';
                        if(result!=null){
                            $.each(result, function(key, val) {
                                if(country==val.countryname_cn){
                                    cid=val.countryid;
                                    html+='<option value="'+val.countryid+'" selected>'+val.countryname_cn+'</option>';
                                 }else{
                                    html+='<option value="'+val.countryid+'">'+val.countryname_cn+'</option>';
                                }
                            });
                            
                            $("#cid").html(html);

                            $.getJSON("index.php?m=Admin&c=Hospital&a=city_list&cid="+cid,function(result){
                                var html='';
                                if(result!=null){
                                    $.each(result, function(key, val) {

                                        if(val.id==zidd){
                                            html+='<option value="'+val.id+'" selected>'+val.name+'</option>';
                                        }else{
                                            html+='<option value="'+val.id+'">'+val.name+'</option>';
                                        }
                                    });
                                }
                                $("#zid").html(html);
                            });
                            
                            
                        }
                        
                    });

            //============================= 获取图片地址===========================================
            $.getJSON("index.php?m=Admin&c=Hospital&a=update_imgs&type=1",function(result){
                hotelId=result.id;
                if(result!=null){
                    var num= result.num;//统计拼接图片的总数量&&&&&//用于计数，用于判断增加图片上传表单时需要再上传多少张图片。
                    dataNum=num-1;
                    for(var i=0; i<=num-1; i++){
                        var addhtml= '<div  class="form-group" id="imgs'+i+'">';
                        addhtml+="<label for='inputtext' class='col-md-2 control-label'></label>";
                        addhtml+= '<div class="col-xs-6 col-md-2"><a href="#" class="thumbnail"><img src="./imagecn_xxHos/'+result[i].imgs +'"></a>';
                        addhtml+='<div class="col-md-5">&nbsp;&nbsp;<div class="col-md-8"><a class="btn btn-success" id="del'+i+'" onclick="del('+"'"+result[i].imgs+"',"+i+')" >删除</a></div></div></div>';
                        $("#addHotel").after(addhtml);
                  }
             }
         });
    }


                function loads(){
                    var a=$("#cid").find("option:selected").val();
                    $.getJSON("index.php?m=Admin&c=Hospital&a=city_list&cid="+a,function(result){
                        var html='';
                        if(result!=null){
                            $.each(result, function(key, val) {
                                html+='<option value="'+val.id+'">'+val.name+'</option>';
                            });
                        }
                        $("#zid").html(html);
                    });

                }

        //===================================增加图片上传表单=====================================
        $("#but").click(function(){

            if(dataNum<4){
                dataNum++;
                var newRow='<div  class="col-md-4 col-md-offset-2"><input type="file" name="imgs[]" id="inputImage'+dataNum+'"/></div>';
                newRow+='<div class="col-md-2"><a class="btn btn-success" id="inputDel'+dataNum+'" onclick="inputDel('+dataNum+')" >删除</a></div>';
                $("#addInput").after(newRow);

            }

        });
        //========================删除修改显示的图片===========================
        function del(obj,obj1){
            if(dataNum<0){
                return;
            }
            $.getJSON("index.php?m=Admin&c=Hospital&a=update_imgs&type=2&imgNum="+obj,function(result){
                dataNum--;
                if(result!=0){
                    $("#imgs"+obj1).remove();
                }
            });
        }
        //============================删除添加表单的==================================
        function inputDel(obj){
            dataNum--;
            $("#inputImage"+obj).remove();
            $("#inputDel"+obj).remove();
        }
	</script>


</body>
</html>

